Implement Slack Socket Mode, Discord MESSAGE_CONTENT intent, and bridge fixes#2252
Open
johnnyxmas wants to merge 9 commits into42wim:masterfrom
Open
Implement Slack Socket Mode, Discord MESSAGE_CONTENT intent, and bridge fixes#2252johnnyxmas wants to merge 9 commits into42wim:masterfrom
johnnyxmas wants to merge 9 commits into42wim:masterfrom
Conversation
- Migrate Slack bridge from RTM to Socket Mode (slackevents + socketmode packages) - Add AppToken field to Protocol config for Slack bot app-level tokens (xapp-*) - Update Slack message handlers to use Events API event types from slackevents - Fix Slack API calls (GetBotInfo, GetConversationInfo) for Socket Mode compatibility - Add MESSAGE_CONTENT privileged intent to Discord bridge for reading message content/embeds - Replace MakeIntent() with direct bitwise OR for cleaner intent configuration
- Slack: Document bot token (xoxb-) and App-Level Token (xapp-) requirements for Socket Mode - Slack: Remove outdated references to legacy tokens - Discord: Note MESSAGE_CONTENT privileged intent requirement in token documentation
…event echos on Discord<>Slack Issue: When you edit a Discord message, matterbridge correctly updates the corresponding Slack message via UpdateMessage. But Slack then fires a message_changed event, and the Slack bridge's skipMessageEvent fails to recognize it as its own edit because: For message_changed events, Slack puts the bot_id on ev.Message.BotID (the inner message), but the code only checks ev.BotID (the outer event envelope, which is empty) The callback ID block check also fails because blocks are posted at the top level, not inside attachments So the edited message round-trips: Discord edit → Slack update → Slack bridge picks it up → bridges back to Discord as a new message from [slack]. Fix: Added a check for ev.Message.BotID in handlers.go:178-183 so that message_changed events from the bridge's own bot are properly skipped.
The hasOurCallbackID check was only looking inside ev.Attachments[0].Blocks, but MsgOptionBlocks() puts blocks at the top-level ev.Blocks field. This meant the callback ID was never found for Socket Mode/Events API events, making the bridge unable to reliably recognize its own messages and causing edit echoes. Now checks ev.Blocks.BlockSet and ev.Message.Blocks.BlockSet (for message_changed events) in addition to the attachment-nested locations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The callback ID block check only looked at BlockSet[0], but Slack can inject rich_text blocks before our SectionBlock. Now iterates all blocks. Also adds ev.User == b.si.UserID check for cases where BotID doesn't match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Token(xoxb-) andAppToken(xapp-) now.skipMessageEventfailing to recognizemessage_changedevents from the bridge's own bot, which caused Discord edits to round-trip back as new messages via Slack.BlockSet[0], but Slack can injectrich_textblocks before ourSectionBlock, causing the bridge to miss its own marker and re-relay messages back to the source. Now iterates all blocks. Also addedev.User == b.si.UserIDcheck for cases where the event'sBotIDdoesn't matchb.si.ID.getNick()now usesMember.DisplayName()(server nick > global display name > username), matching Discord's UI display priority instead of falling back directly to the raw username handle.RealNamebefore the handle (user.Name), matching Slack's own display behavior. Previously, users without aDisplayNameset would show only their short handle (e.g. "jeff") instead of their full name (e.g. "Jeff Jarmoc").Changed files
bridge/slack/slack.go,bridge/slack/handlers.go— Socket Mode migration + echo fixes (edit echo, block iteration, UserID check)bridge/slack/helpers.go,bridge/slack/users_channels.go— RealName fallback for username resolutionbridge/discord/discord.go— MESSAGE_CONTENT intentbridge/discord/helpers.go— DisplayName() fix in getNick()bridge/config/config.go— AppToken fieldmatterbridge.toml.sample— Updated docs for Socket Mode and Discord intentsREADME.md— Slack scopes, Discord permissions, updated examplerelease_1.27/— Rebuilt all 7 platform binariesTest plan
chat:write.customizescope)🤖 Generated with Claude Code